<?
session_start();
	require_once('includes/conn.php');
	include("includes/config.inc.php");
	include("includes/functions_emagineit.php");
	include('includes/class.html2text.inc');
	$obj = new EmagineIT();
	
	if(!isset($_REQUEST["page"]))
	{
		 header( "HTTP/1.1 301 Moved Permanently" );		//PAGE REDIRECTION
		 header( "Location: ".$path."index.htm");
	}
	else
	{
			$page_from_db 		= $obj->display_page($_REQUEST["page"], $conn);
			if($page_from_db != NULL)
			{
				$page_to_include 		= $content_path.$contents[$_REQUEST['page']];
				$page_content_title     = $page_from_db["content_title"];
				$page_physical_name     = $page_from_db["page_physical_name"];
				$page_intro  			= $page_from_db["content_intro"];
				$page_contents 			= $page_from_db["content_desc"];
				$page_title				= $page_from_db["title"];
				$page_chinese_contents 	= $page_from_db["content_chinese_desc"];
				$page_chinese_caption 	= $page_from_db["content_chinese_caption"];
				$page_english_caption 	= $page_from_db["content_english_caption"];
				$page_image 			= $page_from_db["content_image"];
				
				$page_description		= $page_from_db["description"];
				$page_keywords			= $page_from_db["keywords"];
				$page_copyright			= $page_from_db["copyright"];
				$page_author			= $page_from_db["author"];
				$page_robots			= $page_from_db["robots"];
			}
			else
			{
				$CUSTOM_404_VAR = $obj->display_page("page-not-found.htm", $conn);
				$page_content_title     = $CUSTOM_404_VAR["content_title"];
				$page_physical_name     = $CUSTOM_404_VAR["page_physical_name"];
				$page_intro  			= $CUSTOM_404_VAR["content_intro"];
				$page_contents 			= $CUSTOM_404_VAR["content_desc"];
				$page_title				= $CUSTOM_404_VAR["title"];
				$page_description		= $CUSTOM_404_VAR["description"];
				$page_keywords			= $CUSTOM_404_VAR["keywords"];
				$page_copyright			= $CUSTOM_404_VAR["copyright"];
				$page_author			= $CUSTOM_404_VAR["author"];
				$page_robots			= $CUSTOM_404_VAR["robots"];
			}
		
	}
	if(!isset($_REQUEST["page"]))
	{
			$_REQUEST["page"]="aboutus.htm";
			$page_from_db 		= $obj->display_page($_REQUEST["page"], $conn);
			if($page_from_db != NULL)
			{
				$page_to_include 		= $content_path.$contents[$_REQUEST['page']];
				$page_content_title     = $page_from_db["content_title"];
				$page_physical_name     = $page_from_db["page_physical_name"];
				$page_intro  			= $page_from_db["content_intro"];
				$page_contents 			= $page_from_db["content_desc"];
				$page_title				= $page_from_db["title"];
				$page_chinese_contents 	= $page_from_db["content_chinese_desc"];
				$page_chinese_caption 	= $page_from_db["content_chinese_caption"];
				$page_english_caption 	= $page_from_db["content_english_caption"];
				$page_image 			= $page_from_db["content_image"];
				
				$page_description		= $page_from_db["description"];
				$page_keywords			= $page_from_db["keywords"];
				$page_copyright			= $page_from_db["copyright"];
				$page_author			= $page_from_db["author"];
				$page_robots			= $page_from_db["robots"];
				}
	}
?>


<?


?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="description" content="<?=$page_description?>">
<meta name="keywords" content="<?=$page_keywords?>">
<meta name="copyright" content="<?=$page_copyright?>">
<meta name="author" content="<?=$page_author?>">
<meta name="Robots" content="<?=$page_robots?>">

<? if($_REQUEST['page']=='index.htm'){?>
<title>Lyn's Coupon :: Home</title>
<? } else { ?>

<title>Lyn's Coupon :: <?=$page_title?></title>
<? } ?>



</head>

<body>
</td>
  </tr>
        <tr>
        <td>
		
		<? if($_REQUEST['page']=='index.htm')
		   {
		   
		   $sql1 = "SELECT * FROM contents WHERE page_physical_name='index.htm' and status = 1 ";
	 		$res1 = mysql_query($sql1, $conn) or die(mysql_error());
	  		$row1 = mysql_fetch_array($res1);
		  ?>
		
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td colspan="3" valign="top">Welcome to Lyn's Coupon</td>
                </tr>
              
            </table></td>
          </tr>
        </table> 
		<? }  else  { ?> 
		
		<table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td>
			
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
			<tr>
                <td valign="top" colspan="2">
				
				<table width="100%" border="0" cellspacing="0" cellpadding="0">
                        <tr>
                         <td><?php /*?><?=stripslashes($page_title)?> <br />
                            <?=stripslashes($page_contents)?> <br /><?php */?>
							
							<?  
					 $explode_page=explode("?",$_REQUEST['page']);
					 $_REQUEST['page']=$explode_page[0];
					 
					
							$page_to_include = $content_path.$contents[$_REQUEST['page']];
							include($page_to_include);
					 
					   
					  
					?>		                          </td>
                        </tr>
                        	  
						  
                      </table>
				                  </td>
              </tr>
            </table>			</td>
          </tr>
		
        </table>
		
		 <? 
		 	
		 } ?>		</td>
        </tr>
    </table></td>
  </tr>
  
  
</table>
</body>
</html>
